package com.kuaidi.zhangke.kuaidi;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * 首页
 */
public class OneActivity extends AppCompatActivity {

    @BindView(R.id.main_btn_jijian)
    Button mainBtnJijian;
    @BindView(R.id.main_btn_qujian)
    Button mainBtnQujian;
    @BindView(R.id.main_btn_post)
    Button mainBtnPost;
    @BindView(R.id.main_btn_huiyuan)
    Button mainBtnHuiyuan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.CAMERA)
                != PackageManager.PERMISSION_GRANTED)
        {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.CAMERA},
                    123);
        }
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.SEND_SMS)
                != PackageManager.PERMISSION_GRANTED)
        {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.SEND_SMS},
                    456);
        }
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.READ_SMS)
                != PackageManager.PERMISSION_GRANTED)
        {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.READ_SMS},
                    789);
        }
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.RECEIVE_SMS)
                != PackageManager.PERMISSION_GRANTED)
        {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.RECEIVE_SMS},
                    987);
        }




    }

    @OnClick({R.id.main_btn_jijian, R.id.main_btn_qujian, R.id.main_btn_post, R.id.main_btn_huiyuan})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.main_btn_jijian:
                Toast.makeText(OneActivity.this,"暂未实现",Toast.LENGTH_SHORT).show();
                break;
            case R.id.main_btn_qujian:
                Toast.makeText(OneActivity.this,"暂未实现",Toast.LENGTH_SHORT).show();
                break;
            case R.id.main_btn_post:
                Intent intent =new Intent(OneActivity.this,TwoActivity.class);
                startActivity(intent);
                finish();

                break;
            case R.id.main_btn_huiyuan:
                Toast.makeText(OneActivity.this,"暂未实现",Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
